# -*- coding: utf-8 -*-

import  requests
import subprocess

#文本形式
# url = 'http://www.163.com'
# r = requests.get(url)
# print(r.text)

#非文本形式
url1 = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1582365578130&di=e0068940a88a8aa5d7660e8aa49a4419&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2Ff%2Fb9%2F387a792101.jpg'
#url1 = 'http://img1.imgtn.bdimg.com/it/u=2313085298,1614000353&fm=11&gp=0.jpg'
r = requests.get(url1)
with open('/opt/girl2.jpg','wb') as fg:
    fg.write(r.content)
result = subprocess.run('eog /opt/girl2.jpg',shell=True)


#url2 = 'http://www.weather.com.cn/data/sk/101010100.html'
# url2 = 'http://www.weather.com.cn/data/zs/101010100.html'
# r2 = requests.get(url2)
# r2.encoding = 'utf8'
# print(r2.json())

#传参
# kd_url = 'http://www.kuaidi100.com/query'
# params = {'type':'youzhengguoji','postid':'788009347188571832'}
# r = requests.get(kd_url,params=params)
# print(r.json())

#修改请求头
# js_url = 'http://www.jianshu.com'
# headers = {'User-Agent':'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'}
# r = requests.get(js_url,headers=headers)
# print(r.text)


